package com.android.job.ui.adapter;
import com.android.job.ui.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ItemAdapter extends BaseAdapter
{
private String[] stings;
private ViewHolder holder;
private Context mContext;
	
	









	public ItemAdapter(String[] stings,  Context mContext)
{
	super();
	this.stings = stings;
	this.mContext = mContext;
}

	@Override
	public int getCount()
	{
		return stings.length;
	}

	@Override
	public Object getItem(int position)
	{
		return position;
	}

	@Override
	public long getItemId(int position)
	{
		return position;
	}
	
	
	public void setStringArray(String[] strings){
		this.stings = stings;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		if (convertView == null)
		{
			holder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(
					R.layout.select_item, null);
			holder.itemText = (TextView) convertView
					.findViewById(R.id.item_text);
			convertView.setTag(holder);
		}
		else
		{
			holder = (ViewHolder) convertView.getTag();
		}
		
		holder.itemText.setText(stings[position]);
		
		
		return convertView;
	}
	
	private class ViewHolder
	{
		private TextView itemText;
	}

}
